package engine;

import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

import engine.graphics.MapCanvas;
import engine.graphics.MapCanvasEngine;

public final class Midlet extends MIDlet {

	private MapCanvas canvas;

	public static MapCanvasEngine canvasEngine;

	private Display display;

	public Midlet() {
		//
	}

	protected void destroyApp(final boolean arg0) throws MIDletStateChangeException {
		this.canvas = null;
		notifyDestroyed();
	}

	protected void pauseApp() {
		notifyPaused();
	}

	protected void startApp() throws MIDletStateChangeException {
		this.display = Display.getDisplay(this);
		this.canvas = new MapCanvas();
		this.display.setCurrent(this.canvas);
		MapCanvasEngine.canvas = this.canvas;
		canvasEngine = new MapCanvasEngine();
		canvasEngine.start();		
	}

}
